package com.efast.dmom.equipment.statemach.handler.checking;

import com.alibaba.fastjson.JSONObject;
import com.efast.cafe.commponent.statemach.annotation.StatemachHandle;
import com.efast.cafe.commponent.statemach.base.HandleBaseProcessorService;
import com.efast.dmom.equipment.bean.EquipCheckItemParsmBean;
import com.efast.dmom.equipment.service.checking.IEquipCheckingOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
@StatemachHandle(handleName="dosubmit",configId=1000,entityName ="equipCheckItems")
public class EquipCheckingItemsDoSubmitHandler implements HandleBaseProcessorService<EquipCheckItemParsmBean> {

    @Autowired
    private IEquipCheckingOrderService iEquipCheckingOrderService;
    @Override
    public void process(JSONObject taskBean, EquipCheckItemParsmBean bean, Map<String,JSONObject> map) {

        Integer id=Integer.parseInt(map.get("equip_checking_order").get("id").toString());
        //设置点检主表id
        bean.setOrderId(id);
        //保存点检子表数据
        iEquipCheckingOrderService.saveCheckingOrderItems(bean);
    }
}
